package top.yihoxu.yojcodesandbox.docker;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.PingCmd;
import com.github.dockerjava.api.command.PullImageCmd;
import com.github.dockerjava.api.command.PullImageResultCallback;
import com.github.dockerjava.api.model.PullResponseItem;
import com.github.dockerjava.core.DockerClientBuilder;

/**
 * @Author dth
 * @Date 2024/5/5 00:26
 * @PackageName:top.yihoxu.yojcodesandbox.docker
 * @ClassName: DokcerDemo
 * @Description: TODO
 * @Version 1.0
 */
public class DockerDemo {
    public static void main(String[] args) throws InterruptedException {
        DockerClient dockerClient = DockerClientBuilder.getInstance().build();
//        PullImageCmd cmd = dockerClient.pullImageCmd("nginx:latest");
//        PullImageResultCallback pullImageResultCallback = new PullImageResultCallback() {
//            @Override
//            public void onNext(PullResponseItem item) {
//                System.out.println("下载镜像" + item);
//                super.onNext(item);
//            }
//        };
//
//        cmd.exec(pullImageResultCallback).awaitCompletion();

        System.out.println("下载完成");
    }
}
